//
//  visitorView.swift
//  WeiBo
//
//  Created by wukeng-mac on 16/8/22.
//  Copyright © 2016年 wukeng. All rights reserved.
//

import UIKit
import SDWebImage

class visitorView: UIView {
    //MARK:- 控件的属性
    
    @IBOutlet weak var rotationView: UIImageView!
    @IBOutlet weak var iconView: UIImageView!
    @IBOutlet weak var tipLabel: UILabel!
    @IBOutlet weak var registerBtn: UIButton!
    @IBOutlet weak var loginBtn: UIButton!
    
    
    //方面名不能与类名完全一致
    class func VisitorView() -> visitorView {
        return NSBundle.mainBundle().loadNibNamed("visitorView", owner: nil, options: nil).first as! visitorView
    }
    
    func setupVisitorViewInfo(iconName : String,title : String)  {
        iconView.image = UIImage(named: iconName)
        tipLabel.text = title
        rotationView.hidden = true
    }
    
    func addRotationAnimator(){
        //创建动画
        let rotationAnim = CABasicAnimation(keyPath: "transform.rotation.z")
        
        //设置动画属性
        rotationAnim.fromValue = 0
        rotationAnim.toValue = M_PI * 2
        rotationAnim.duration = 10
        rotationAnim.repeatCount = MAXFLOAT
        rotationAnim.removedOnCompletion = false
        
        //添加动画
        rotationView.layer.addAnimation(rotationAnim, forKey: nil)
    }
}
